package com.zany.frame.action;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.zany.login.service.LoginService;
import com.zany.system.vo.UserInfoVO;
import com.zany.login.vo.UserResourceVO;
import com.zany.util.action.BaseCheckAction;


/**
 * 页面 头
 * @author chengY
 * @version 1.0
 */
public class HeaderAction extends BaseCheckAction {

	private static final long serialVersionUID = 8945368798686600923L;
	private static Log logger = LogFactory.getLog(HeaderAction.class);
	private List<UserResourceVO> menulist = new ArrayList<UserResourceVO>();//权限列表
	private LoginService loginService;

	public String execute() {
		if(logger.isInfoEnabled()){
			logger.info("HeaderAction.execute()");
		}
		//从session中获取用户信息
		UserInfoVO userInfo = (UserInfoVO) session.get("userInfo");
		if (userInfo != null) {
			//根据用户信息查询权限列表
			menulist = loginService.getTopMenu(userInfo);
			return this.SUCCESS;
		}
		return this.INPUT;
	}

	public LoginService getLoginService() {
		return loginService;
	}

	public void setLoginService(LoginService loginService) {
		this.loginService = loginService;
	}

	public List<UserResourceVO> getMenulist() {
		return menulist;
	}

	public void setMenulist(List<UserResourceVO> menulist) {
		this.menulist = menulist;
	}
}
